package com.rongc.client.freight.business.carrier.view.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.rongc.client.freight.base.view.adapter.RecyclerChoiceBaseAdapter;
import com.rongc.client.freight.business.mine.model.CarBean;
import com.rongc.client.freight.business.mine.view.widget.CarView;

import java.util.List;

/**
 * Created by Bruce on 2017/07/06.
 */
public class RecyclerChoiceConveyanceAdapter extends RecyclerChoiceBaseAdapter<CarBean> {

    public RecyclerChoiceConveyanceAdapter(Context mContext, List<CarBean> datas){
        super(mContext,datas);
    }

    @Override
    public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = new CarView(mContext);
        return new BaseRecyclerViewHolder(view);
    }

    @Override
    protected int getLayoutId() {
        return 0;
    }

    @Override
    protected void onBind(BaseRecyclerViewHolder holder, int position, CarBean data) {
        ((CarView) holder.itemView).setDesc(data.getModel());
        if(sp != null) {
            ((CarView) holder.itemView).setChecked(sp.get(position));
        }else{
            ((CarView) holder.itemView).setChecked(false);
        }
    }

}

